package com.shsubway.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shsubway.R;
import com.shsubway.model.ScoreEntity;

import java.util.List;

/**
 * Created by Hu on 2017/3/14.
 */

public class ScoreAdapter extends BaseQuickAdapter<ScoreEntity, BaseViewHolder> {
    boolean isManager;

    public ScoreAdapter(int layoutResId, List<ScoreEntity> data, boolean isManager) {
        super(layoutResId, data);
        this.isManager = isManager;
    }

    @Override
    protected void convert(BaseViewHolder helper, ScoreEntity item) {
        helper
                .setText(R.id.test_no, isManager ? item.getUserName() : "编号：" + item.getTestId())
                .setText(R.id.score_all, item.getScore() + "分")
                .setText(R.id.test_dan, "单选题，对：" + item.getDanNo() + "，共：" + item.getDanNoAll())
                .setText(R.id.test_duo, "多选题，对：" + item.getDuoNo() + ",半对：" + item.getDuoWrongNo() + "，共：" + item.getDuoNoAll())
                .setBackgroundRes(R.id.layout_id, item.getTestType() == 0 ? R.drawable.bg_edittext_focused : R.drawable.qqq)
                .setText(R.id.test_pan, "判断题，对：" + item.getPanNo() + "，共：" + item.getPanNo())
                .setText(R.id.test_date, "日期：" + item.getCreatedAt());
    }
}
